import ElSelectOption from '@model/types/ElSelectOption'
import i18n from '@src/locales'
import { haveProviderManager } from '@src/util/grayInfo';

/* 规则类型 */
export enum RuleTypeEnum {
  // 按照工单类型
  Type = 'type',
  // 按照特定条件
  Select = 'select',
  // 按照客户所属部门
  Tag = 'cusTag',
  // 按照服务位置
  Service = 'service'
}

/* 分配枚举 */
export enum AllotGroupEnum {
  // 指定人员
  User = 'user',
  // 指定角色
  Role = 'role',
  // 指定服务部门
  Tag = 'tag',
  // 指定服务部门主管
  TagLeader = 'tagLeader',
  // 指定客户负责人
  CustomerManager = 'customerManager',
  // 客户所属服务部门
  CustomerTag = 'cusTag',
  // 客户所属服务部门主管
  CustomerTagLeader = 'cusTagLeader',
  // 服务位置所属服务部门
  ServicePositionTag = 'servicePositionTag',
  // 服务位置所属服务部门主管
  ServicePositionTagLeader = 'servicePositionTagLeader'
}

/* 优先顺序枚举 */
export enum AllotOrderEnum {
  // 未完成工作数量少优先派单
  UnfinishedTask = 'unfinishedTask',
  // 距离越近优先派单
  Distance = 'cusDistance',
  // 按顺序平均分配
  Polling = 'polling'
}

/* 按照服务位置分配枚举 */
export enum AllotServeEnum {
  // 服务位置所属服务部门
  ServicePositionTag = 'servicePositionTag',
  // 服务位置所属服务部门主管
  ServicePositionTagLeader = 'servicePositionTagLeader',

  ServiceProviderPosition = 'serviceProviderPosition',
}
/* 操作符枚举 */
export const AllotOperatorEnum:any = {
  // 包含
  Contains: i18n.t('common.base.include') as string,
  // 不包含
  UnContains: i18n.t('common.base.exclude') as string,
  // 等于
  Equal: i18n.t('common.base.equal') as string,
  // 不等于
  UnEqual: i18n.t('common.base.notEqual') as string,
}

/* 派单时间准则 */
export enum ScheduleStandardEnum {
  // 以工单创建时间匹配班次人员
  CreateTime = 'createTime',
  // 以计划开始时间匹配班次人员
  PlanStartTime = 'planStartTime'
}

/* 分配select默认选项列表 */
export const AllotGroupSelectDefaultOptions: ElSelectOption[] = [
  { label: i18n.t('common.base.userTypes.designatedUser') as string, value: AllotGroupEnum.User },
  { label: i18n.t('common.base.userTypes.designatedRole') as string, value: AllotGroupEnum.Role },
  { label: i18n.t('common.base.userTypes.designatedService') as string, value: AllotGroupEnum.Tag },
  { label: i18n.t('common.base.userTypes.designatedServiceManager') as string, value: AllotGroupEnum.TagLeader },
  { label: i18n.t('common.base.userTypes.designatedCustomerManager') as string, value: AllotGroupEnum.CustomerManager }
]

/* 分配select部门选项列表 */
export const AllotGroupSelectTagOptions: ElSelectOption[] = [
  { label: i18n.t('task.components.allotRuleModal.customerServiceDepartment') as string, value: AllotGroupEnum.CustomerTag },
  { label: i18n.t('task.components.allotRuleModal.customerServiceDepartmentManager') as string, value: AllotGroupEnum.CustomerTagLeader }
]

/* 分配select默认选项列表 */
export const AllotOrderOptions: ElSelectOption[] = [
  { label: i18n.t('task.components.allotRuleModal.lessUnfinishedTaskPriorityAllot') as string, value: AllotOrderEnum.UnfinishedTask },
  { label: i18n.t('task.components.allotRuleModal.closerDistancePriorityAllot') as string, value: AllotOrderEnum.Distance },
  { label: i18n.t('task.components.allotRuleModal.distributeEvenlyInOrder') as string, value: AllotOrderEnum.Polling }
]

/* 按照服务位置分配select默认选项列表 */
export const AllotServeOptions: ElSelectOption[] = [
  { label: i18n.t('task.components.allotRuleModal.serviceAddressDepartment') as string, value: AllotServeEnum.ServicePositionTag },
  { label: i18n.t('task.components.allotRuleModal.serviceAddressDepartmentManager') as string, value: AllotServeEnum.ServicePositionTagLeader },
  ...(haveProviderManager() ? [{ label: i18n.t('task.components.allotRuleModal.locationForServiceProvider') as string, value: AllotServeEnum.ServiceProviderPosition }] : []),
]

/* 包含 操作符选项列表 */
export const ConditionOpeartorOptions: ElSelectOption[] = [
  { label: i18n.t('common.base.include') as string, value: AllotOperatorEnum.Contains },
  { label: i18n.t('common.base.exclude') as string, value: AllotOperatorEnum.UnContains },
]

/* 等于 操作符选项列表 */
export const EqualOpeartorOptions: ElSelectOption[] = [
  { label: i18n.t('common.base.equal') as string, value: AllotOperatorEnum.Equal },
  { label: i18n.t('common.base.notEqual') as string, value: AllotOperatorEnum.UnEqual },
]

export const ScheduleStandardOptions: ElSelectOption[] = [
  { label: i18n.t('task.components.allotRuleModal.matchShiftUserByTaskCreateTime') as string, value: ScheduleStandardEnum.CreateTime },
  { label: i18n.t('task.components.allotRuleModal.matchShiftUserByPlanStartTime') as string, value: ScheduleStandardEnum.PlanStartTime },
]